<template>
  <section>
    <img class="banner" src="https://www.wutongyoushu.com/wp-content/uploads/2023/03/1167610aa1234534.jpg" />
    <div class="dataType">
      <div class="dataType-imgs" v-for="(item, index) in dataType" :key="index">
        <img :src="item.imgs" />
      </div>
    </div>
    <div class="title">
      项目内容
    </div>
    <div class="project">
      <div class="project-content" v-for="(item, index) in dataList" :key="index">
        <div class="project-content-img" @click="particulars()">
          <img :src="item.url" />
        </div>
        <div class="project-content-title">{{ item.title }}</div>
        <div class="project-content-explain">
          <span>付费阅读 ${{ item.price }}</span>
          <span>{{ item.type }}</span>
        </div>
        <div class="project-content-releaseTime">发布时间：{{ item.dateTime }}</div>
      </div>
    </div>
  </section>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import router from '@/router';

/**
 * 数据资料类型
 */
const dataType = ref<{ title: string, path: string, imgs: string }[]>([
  {
    title: '素材资源',
    path: '',
    imgs: 'http://www.wutongyoushu.com/wp-content/uploads/2023/03/8918fd0a40230502.jpg',
  },
  {
    title: '流量课程',
    path: '',
    imgs: 'https://www.wutongyoushu.com/wp-content/uploads/2023/03/8918fd0a40232732.jpg',
  },
  {
    title: '虚拟课程',
    path: '',
    imgs: 'https://www.wutongyoushu.com/wp-content/uploads/2023/03/8918fd0a40002859.jpg',
  },
  {
    title: '实体创业课程',
    path: '',
    imgs: 'https://www.wutongyoushu.com/wp-content/uploads/2023/03/8b3825fbdc003629.jpg',
  },
]);
/**
 * 项目数据
 */
const dataList = ref<{ title: string, type: string, dateTime: string, price: string, url: string }[]>([
  {
    title: '视频号原创视频玩法，日收益500+',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141808334-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
  {
    title: '大众点评人计划，简简单单几分钟三位数',
    type: '副业项目',
    dateTime: '2023-12-10 12:22',
    price: '39',
    url: 'https://www.wutongyoushu.com/wp-content/uploads/2023/12/20231229141154493-1.webp'
  },
]);

/**
 * 点击跳转到项目内容详情
 */
const particulars = () => {
  router.push('/particulars');
}

</script>

<style scoped lang="less">
.banner {
  width: 100%;
  border-radius: 10px;
  margin-top: 10px;
}

.dataType {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  overflow: hidden;

  &-imgs {
    width: 24.5%;
    overflow: hidden;
    border-radius: 10px;

    img {
      width: 100%;
      border-radius: 10px;
      transition: all 1s;
    }

    img:hover {
      overflow: hidden;
      transform: scale(1.2);
      cursor: pointer;
    }
  }

}

.title {
  margin-top: 10px;
  border-left: 5px solid #f04494;
  padding-left: 10px;
}

.project {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;

  /* 左右间隔为 10px */
  &-content {
    background: white;
    border-radius: 10px;
    height: 280px;
    flex: 1 0 calc(25% - 8px);
    box-sizing: border-box;
    border: 1px solid white;
    padding: 10px;
    overflow: hidden;
    max-width: calc(25% - 8px);

    &-img {
      width: 100%;
      border-radius: 10px;
      overflow: hidden;

      img {
        width: 100%;
        border-radius: 10px;
        transition: all 1s;
      }

      img:hover {
        transform: scale(1.2);
        cursor: pointer;
      }
    }

    &-title {
      font-weight: bold;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
      -webkit-line-clamp: 2;
      height: 42px;
      // color: #4E5358;
    }

    &-explain {
      font-size: 14px;
      margin-top: 10px;

      span:nth-child(1) {
        background: linear-gradient(135deg, #f59f54 10%, #ff6922 100%);
        padding: 4px;
        color: white;
        border-radius: 5px;
      }

      span:nth-child(2) {
        display: inline-block;
        margin-left: 20px;
        color: #2997f7;
        background: rgba(41, 151, 247, 0.1);
        padding: 4px;
        border-radius: 5px;
      }
    }

    &-releaseTime {
      margin-top: 10px;
      font-size: 14px;
    }
  }
}
</style>
